home *** CD-ROM | disk | FTP | other *** search
- 06600020202800
- 1AIM TUTORIALPage # ofFile: AIMTUTOR.DOC
- 2
- F0110030
- 9[...................................................]011
- ü
-
-
-
-
-
-
-
-
-
-
- ëAIMTUTORIAL
- 9[...................................................]011
- Ç
-
- by
-
-
- TomHoeksmaandAdHerweijer
-
-
-
- DelftUniversityofTechnology
- FacultyofAppliedPhysics
- PatternRecognitionGroup
- Lorentzweg1
- 2628CJDELFT
- theNetherlands
- ëIntroductionê
- Ç
- TheimageprocessingsoftwarepackageAIM(AtariImageManager)
- hasbeendevelopedatDelftUniversityofTechnologybyFrans
- Groen(the'imageprocessor')andwasadaptedfortheAtariST
- computerincooperationwithRobertdeVries(theGEMprogram⑨
- mer).BothweremembersoftheSignal-/System-techniquesGroupin
- theFacultyofAppliedPhysics,Fransasaseniorstaffmember
- andRobertasagraduatestudent.Recently,Franschangedjobsto
- becomeprofessorofAppliedInformaticsintheUniversityof
- Amsterdam.
-
- AIMisdesignedtobeanentrylevel'appetizer'fortheartof
- imageprocessing.Itgivestheinterestedlaypersonan
- opportunitytoacquainthimselfwiththetechniquesand
- terminologyusedinthisdynamicfield.Theexperiments
- describedmayberegardedasalowerboundofwhatcanbe
- accomplishedwithAIM,theupperboundbeinglimitedbythe
- user'simaginationonly.
-
- Thistutorialisnotafullcourseondigitalimageprocessing.
- SuchcoursesarefrequentlyorganizedbythePatternRecognition
- Group.Forcourseinformation,pleasecontacttheSecretaryof
- thePatternRecognitionGroup,FacultyofAppliedPhysics,
- Lorentzweg1,2628CJDelft,theNetherlands,Phone015-781416.
-
- Notethattheoperationsusedintheexamplesanddemoscovera
- minorpartofAIM'scapabilitiesonly.Acomprehensivedescrip⑨
- tionofalltheoperationsavailableisgiveninafilecalled
- AIMANUAL.DOC.Likethistutorialitiscontainedinacompressed
- file(DOCS_IMS.ARC),whichcanbefoundinthefolderCOMPRESSon
- thedistributiondisk(togetherwithadecompressingprogram).
-
- Imageprocessingisnotparticularlydifficult;manypeoplewill
- havehadtheirfirstimageprocessingexperienceinthe
- photographicdarkroom.Note,however,thatAIM,beingdedicated
- todigitalimageprocessing,requiressomebasicknowledgeof
- digitalsystems.Sothoseofyouwhountilnowhavesuccessfully
- avoidedlearningaboutbits,bytesandbinarynumbers,be
- preparedtofacetheunavoidable!The15minutesorsospenton
- readingabouttheseconceptswillberichlyrewardedbyabetter
- understandingofAIM'soperations,ifnotbythedeepadmiration
- ofyourenvironmentforthenewlyacquiredvocabulary.
-
- AIMisaresultofmanyyearsofresearchanddevelopmentinthe
- PatternRecognitionGroup.Manyoftheimageprocessingroutines
- werecontributedby(a.o.)GertvanAntwerpen,FransGroen,Piet
- Verbeek,BenVerwer,LucasvanVliet,HansBuurmanandIgor
- Weber.Thisintroductionwaswritten(ifnotcompiledfrom
- existingtexts)byTomHoeksmaandAdHerweijer.
-
- PreviousversionsofAIMhavealreadyextensivelypenetratedthe
- AtariSTcommunity.However,asthedocumentationsuppliedwith
- thosefirstpublicdomainversionswasratherlimited,the
- explorationofthesoftwarehasbeenamere'imageprocessing
- adventure'tomostofthe'earlybirds'.Theauthorshopethat
- thisintroduction,togetherwiththerelatedexamplesanddemos
- includedonthedisk,willenableallprospectiveusers(early
- birdsandnewcomersalike)tobetterunderstandwhatwas,resp.
- isgoingon.
- Ç
- Feedbackplaysanimportantroleintheeffectiveuseofimage
- processingaswellasinsoftwaredevelopment.Therefore,we
- inviteyoutosendyoureventualcommentsandsuggestionsto:
-
- Prof.dr.ir.F.C.A.Groen
- c/oDelftUniversityofTechnology
- FacultyofAppliedPhysics
- PatternRecognitionGroup
- Lorentzweg1,2628CJDELFT
- theNetherlands
-
- ë
-
- ëWHATCANWEEXPECTOFIMAGEPROCESSING?Ç
- 9[...................................................]011
-
- MaybeyouhavealreadyhadsomeexperiencewithAIMorseen
- somebodyelseworkwithit.Youmayhavewondered,then,how
- imageprocessingcouldmakefeaturesappearinthedisplaythat
- weren'ttherebeforetheoperation.Textthatatfirstwas
- unreadable,suddenlycouldbereadeasily;frecklesinagirl's
- face,thatdidn'tshowintheoriginaldisplay,could(toher
- distress!)becountedaftersomeappropriatekeystrokes.Youwere
- perhapsconvincedtohaveacquiredalittlemagician,hiddenin
- thattinyfloppydisk.
-
- Bewarned,however!Imageprocessingcanneverreproducefeatures
- oftheoriginalimage,thatsomehowhavebeenlost.So,be
- preparedforsurprises,butdon'texpectmiracles!Image
- processingcanenhanceparticulardetailsinanimage,but
- usuallyotherdetailswillhavetobesacrificed.
-
- If'Apictureisworthathousandwords',imageprocessingallows
- youtoarrangethosewordstomakethepicturerevealits
- (secret)'stories'.Butremember:onepicture'sthousandwords
- aredifferentfromanother's.Everystorywillinheritthe
- characteristicsofthepictureitwasextractedfrom.Theartof
- imageprocessingis:tomakethepicturetelltheonestory
- that'susefultoyou.
-
-
- ë
- STAGESINANIMAGEPROCESSINGAPPLICATIONÇ
-
- Inalmosteveryimageprocessingapplicationwecanrecognize
- somestages,thateventuallyleadtothefinalresult:ürecordingÇ,
- üpreprocessingÇ,üsegmentationÇ,üpostprocessingÇ,üanalysisÇandüinter⑨Ç
- üpretationÇ.
-
- Probablythemostimportantstageistherecordingofthe
- originalpicture.Asstatedabove,informationthatgetslostin
- therecordingprocesscanneverberecovered.Fortherecordinga
- video-cameraisrequired,capableofconvertingthelight,
- reflectedfromtheobject,intoanelectricalsignal.Asthe
- videosignalcannotbereaddirectlybythecomputer,thissignal
- mustbesampledanddigitizedandthedigitalinformationmustbe
- transferredinanorderlymannertothecomputer'smemory.This
- isdonebyaspecialpieceofhardware,aso-called'üframe
- grabberÇ'.VariousframegrabbersareavailablefortheAtariST.
- InthePatternRecognitionGroupmonochromeandcolorframe
- grabbershavebeendevelopedthateventuallywillbemade
- commerciallyavailable.
-
- Aftertheimageisstoredinthecomputeritmustbepre⑨
- processed.Heretheusertriestoenhanceorfilterout
- particularwantedresp.unwantedfeatures,tosatisfy
- requirementsoffurtheranalysis.Examplesofpreprocessingare
- thecorrectionforchanginggreyvaluesinthebackground
- (shading),suppressingnoise,determinationofedgesinthe
- image,etc.
-
- ÇInordertobeabletodeterminepropertiesofsingleobjectsin
- theimage,theseobjectsmustfirstbemadedetectable.Ifagrey
- valueimagecontainsdarkobjectsonalightbackground,
- segmentationcan,forinstance,resultinabinaryimagewith
- whiteobjectsinablackbackground.
-
- Postprocessingcanimprovetheresultofthesegmentation.
- Examplesarethemorfological(binary)operations.Holesin
- objectscanbeclosed,edgespeeledoff,etc.
-
- Intheanalysisstage,measurementscanbeperformedonthe
- segmentedobjects.Examples:area,perimeter,curvature.
-
- Intheinterpretationstagetheresultsofthemeasurementsare
- evaluated.
-
- An'intelligentrobot'inafactory,thathastomakeadecision
- onwhetherhe'sees'anutorabolt,mustbeprogrammedtogo
- throughallstagesmentionedhere.Programmingsucharobot
- requiresmuchintuitiononhowcomputers'think'.Animportant
- requirementfortheprogrammeristobeabletoforgetthewayhe
- woulddothejobhimself!Hemustbelongtothenewbreedof
- 'computerpsychologists'.ü
-
-
- ë
- SOMETERMINOLOGYUSEDINIMAGEPROCESSING
- 9[...................................................]011
- Ç
-
- Imagesanddisplaysê
-
- ÇInimageprocessingwemustdistinguishbetween'images'and
- their'displays'.InthiscontextwedefineanüimageÇasthe
- informationthathasbeenstored(as1'sand0's)witha
- particularfilenameinthecomputer'smemoryoronamagnetic
- disk.AüdisplayÇistherepresentationofsuchanimageonavideo
- screenor-asa'hardcopy'-onapieceofpaper.
-
- AnimportantpropertyofanimageisitsüinformationÇcontent.The
- informationinanimagedependsonthepresenceofdetails
- (lines,edges,intensities,colors,etc.).Moreover,the
- informationcontentdeterminestheamountofcomputermemory
- requiredtostoretheimage.
-
- Notethatit'sonethingtostoreanimageaccurately,butthat
- it'sanothertodisplayitwithfullconservationofinformation!
- Thedisplayhardware(videocontroller,monitor,printer,etc.)
- determinesthedegreetowhichtheinformationinanimagecanbe
- observedexactly.Inimageprocessing,thereisatendencyto
- maketheinformationcontentofstoredimageshigherthancan
- actuallybedisplayed.Thisreducesthechancethattheeffects
- ofroundingerrorsinintermediateresultswilldeterioratethe
- finaldisplay.(Moreover,RAM-chipsandfloppydisksaremuch
- cheaperthandisplayhardware!).AIM,forexample,uses64
- kilobytes(kB)ofRAMforthestorageofimages,whereasthe
- Atarihardwarecanonlyhandle32kBforthedisplayofone
- screen(eithermonochromeorcolor).
-
- ÇThebasicelementofanimageisaüpixelÇ(pictureelement).Tobe
- observableonadisplay,apixelmustbeattributedaügreyvalue
- ÇorücolorÇinformation.
-
- Asanexample,considertheAtariST.Inthemonochrome(high
- resolution)modetheAtariSTsupportsthedisplayof2grey
- valuesonly.Eachpixel(theAtariscreenhas640*400=256,000
- ofthem!)hasanumber('0'or'1')associatedwithitthat
- determineswhetheritistobeblackorwhite:thereisnothing
- inbetween.Wewillcallthisa'übinarydisplayÇ'.
-
- Notethattermslike'black','white'and'greyvalue'inthe
- contextofmonochromedisplaysactuallyrefertothecolor
- emittedbythephosphorusedintheCathodeRayTube(üCRTÇ)ofthe
- displaydevice(amber,green,white,etc.).
-
- Colorimagesgenerallyconsistofthreeüsub-imagesÇ,displayed
- simultaneously.Thesub-imagesrepresentthedecompositionofthe
- colorimageintothreemonochromeimages(red,greenandblue,
- respectively).The(visual)additionofthesub-imagesrestores
- theoriginalcolorsfortheobserver.Sub-imagesmaybebinary,
- butusuallytheyhavemorethantwogreyvalues.AnAIMcolor
- image,forexample,has256possiblegreyvaluesforeachsub-
- image.
-
- Inthecolormodes(medium-,resp.low-resolution),theSTis
- capableofdisplaying8greyvaluesforallthreeprimarycolors.
- Consequently,thereare8*8*8=512differentcombinations,each
- combinationrepresentinganothercolor.Suchagroupofavailable
- colorsiscalledaüpaletteÇ.Thepaletterepresentsallpossible
- statesthatanindividualpixelmayhave.
-
- Eachcombinationofred,greenandblueintensitiesisperceived
- withaparticularbrightness,theüluminanceÇ.Luminance
- informationcanbeusedforthedisplayofcolorimagesona
- monochromemonitor;AIMallocatesanextrasub-imageforit.
-
- Ifapixelhasequalintensitiesforred,greenandblue,it
- willdisplaythecolor'grey'.Thus,inthepaletteofthemed-
- resandlo-rescolormodesthereare8levelsofgrey,extending
- fromblack(R=G=B=min=0)towhite(R=G=B=max=7).Veryoftenthe
- propertyofacolormonitortodisplaygreyvalues(asopposedto
- justblackorwhite)ismoreimportanttotheuserthanits
- capabilityofdisplayingcolors!
-
- Aswehaveseenabove,inbinaryimageseachpixelcanhave2
- greyvaluesonly.Wesaythateachpixelhas1'übitÇ'(binary
- digit)ofinformationassociatedwithit.Equivalently,incolor
- imagestheinformationperpixelishigher;AIMuses32bitsof
- colorandgreyvalueinformation.Wewillreturntothisshortly.
-
-
- Pixelsandneighbors.ê
-
- ÇAnAIMimagecanbevisualizedasa'checkerboard'with256*256
- or128*128squarefields(formonochromeandcolorimages,
- respectively).Eachfieldcorrespondstoapixelcarrying8bits
- (=1üByteÇ)ofgreyvalueinformationor32bits(= 3+1Bytes)of
- colorandluminanceinformation.
-
- ÇPixels,beingneatlyarrangedinasquareürasterÇofrowsand
- columns,haveüneighborsÇ.Thenumberofneighborsofaparticular
- pixelisreferredtoasitsüconnectivityÇ.Onacheckerboard
- neighborscanbedefinedashavingeitherjustsides,orsidesas
- wellascorners,incommonwiththereferencepixel.Dependingon
- thesedefinitionstheconnectivityofpixelsonasquareraster
- is4or8.Pixelssometimesarearrangedhexagonally.Insucha
- 'honeycombconfiguration'theconnectivityis6.
-
- Imageprocessingroutinescanbedividedintothreegroups:
- üpointÇ,ülocalÇandüglobaloperationsÇ.
-
- Pointoperationsusetheinformationofonesinglepixelinthe
- inputimagetocalculatetheresultforacorrespondingpixel
- (notnecessarilythesame)intheoutputimage.Anexampleisthe
- INVERToperation,wheretheintensitybitforeverypixelinthe
- (binary)imageisreversed.
-
- Inalocaloperationtheresultforonesinglepixelofthe
- outputimageisdeterminedbytheoriginalpixelandits
- üneighborhoodÇ.AnexampleofsuchanoperationisLmin('Local
- minimum'),wheretheoutputpixelgetstheminimumgreyvalueof
- itsneighborhood(includingitself)intheinputimage.This
- operationextendsdarkpartsintheimage.Theneighborhoodof
- interestcanoftenbespecified(i.e.1*3,3*3,5*5,etc.).In
- AIMtheneighborhoodcanonlybeanoddnumber.
-
- Inglobaloperationstheresultforonesingleoutputpixelis
- derivedfromtheinformationofallpixelsintheinputimage.
- OneexampleofaglobaloperationistheFouriertransform,used
- todetermineperiodicfeaturesintheimage.Fouriertransforms
- arenotsupportedinthisversionofAIM.
-
- ëPROPERTIESOFTHEATARISTVIDEOHARDWARE
-
- ÇAlmostallofAIM'simageswillprobablyhavetobedisplayedon
- avideomonitor(eithermonochromeorcolor).Howeverperfectan
- imagemaybe,itwilleventuallyhavetopassthebottleneckof
- thecomputer'svideodisplayhardware.Muchoftheeffortof
- programmingAIMhasbeendevotedtoovercominginevitable
- limitationsofacomputer'sdisplayhardware.Foracorrect
- interpretationoftheresults,wewillextendbrieflyintosome
- detailsofthehardwareusedbytheAtariSTforthecontrolof
- displays:üvideodisplaymemoryÇ,üvideocontrollerÇandümonitorsÇ.
-
-
- Thevideodisplaymemory.
-
- Thecentralpartofthedisplayhardwareisthevideodisplay
- memory.Independentoftheresolutionchosen(lo-,med-,hi-res),
- theAtariSTallocates32kB(=256,000bits)ofRAMforstorage
- oftheinformationofonescreen.
-
- Inthehighresolutionmode640*400=256,000pixelscanbe
- displayed,leavingjustonebit/pixelforgreyvaluedefinition.
- Asaresultonlybinaryimagescanbedisplayedonamonochrome
- monitor.
-
- ÇAsexplainedabove,acolorimagerequiresmorethan1bitof
- memoryperpixel.YoumaywonderhowtheSTmanagestoattribute
- morethan1bittoapixelifinthehi-resmode(1bit/pixel)
- alltheavailable32kBisusedupalready!
-
- Theanswertothisquestioncanbeintuitivelyfoundfromthe
- terms'medium-resolution'and'low-resolution'forthecolor
- modes.Inthesemodes,thespatialresolutionofthehi-resmode,
- 640*400=256,000pixels,issacrificedinordertogivethe
- pixelsmoreluminance(monochromedisplaysoncolormonitors)or
- colorinformation.Byreducingtheresolutionto640*200=
- 128,000(med-res)or320*200=64,000pixels(lo-res),thepixels
- canbeattributed2or4bitsforluminanceorcolordefinition.
- Thisallowspalettesof4or16colorstobedefinedinthemed-
- resorlo-resmode,respectively.
-
- Thus,thevideodisplaymemorymaybethoughtofasrepresenting:
-
- 1binaryimage of640*400pixels(hi-res)
- 2binaryimagesof640*200pixels(med-res)
- 4binaryimagesof320*200pixels(lo-res).
-
- Thecolorofaparticularpixelisdeterminedbythe(weighted)
- bit-valuesofthe2/4correspondingpixelsinthebinaryimages.
-
- Thevideocontroller.
-
- Thenextstoponourjourneyfromthevideodisplaymemorytothe
- monitorscreenisthevideocontroller.Thischiptakescareof
- allthehousekeeping,requiredforconversionofthebytesinthe
- videodisplaymemoryto'realworld'voltages,compatiblewith
- theintensityinput(s)ofthemonitors.
-
- Sinceinthehi-resmodethepixelscontainjust1bitofgrey
- valueinformation,thevideocontrollerincorporatesavery
- simple1bit'A/Dconverter'togeneratetheintensitysignalfor
- themonochromemonitor.
-
- Wehaveseenthat,asaconsequenceofthelimited32kBofvideo
- displaymemory,inthemed-resandlo-resmodesthepixelscan
- havejust2/4bitsofcolorinformation.Thiswouldallowfor
- palettesof4/16colors.Fortunately,AtarihasmadetheSTmuch
- moreversatile,generouslyincludingthree3bitA/Dconverters
- inthevideocontroller.Thus,foreachprimarycolorthereare8
- greyvaluesavailable,allowingapaletteof8*8*8=512colors.
-
- Ifthepixelscontaininformationforthedefinitionof4/16
- colorsonly,howdoesthevideocontrollerknowwhatcolorsto
- choosefromthepaletteof512?Theanswerisintheoperating
- system;ithasfacilitiestodefinea'sub-palette'of4/16
- colors.Eachcolorinthesub-paletterepresentsaparticular
- combinationofgreyvaluesforred,greenandblue.These
- combinationsarestoredinalookuptableof4/16elements.The
- 2/4bitcolorinformationforeachpixelreferstoapositionin
- thislookuptableandthevideocontrollerconvertstheRGB-
- combinationstoredthereintothecorrespondingintensitycontrol
- voltages.
-
- ÇWhenacolormonitorisusedtodisplayamonochromegreyvalue
- image,theoperatingsystemautomaticallyloadsthelookuptable
- with4/8(whynot16?)greycombinationsformed-resorlo-res
- displays,respectively.
-
-
- Themonitors.
-
- Basically,avideomonitorconsistsofaCRTwithsomeelectronic
- circuitrytocontrolthedeflectionandtheintensityofthe
- electronbeam.Amonochromemonitorusesoneelectronbeam.A
- colormonitorrequiresthreebeams,oneforeachprimarycolor.
-
- Forintensitycontrolthemonitorshave1or3inputs.The
- voltageontheseinputsdeterminestheintensityofthelightspot
- onthescreen.
-
- Note,thatinprinciplebothmonochromeandcolormonitorsare
- capableofdisplayinggreyvalues:thereisacontinuousrange
- overwhichtheintensitiescanbecontrolled.However,aswehave
- seen,theotherdisplayhardwarereducesthenumberofpossible
- greyvaluesand/orcolorsconsiderably.
-
- Thedeflectionoftheelectronbeam(s)iscontrolledbythe
- monitoritself;forsynchronizationitneedsatriggeringsignal
- ('sync')whichisproducedbythevideocontrollerandsimply
- addedtotheintensitysignal(s).
-
-
-
- ëAIMIMAGESANDTHEIRDISPLAYONTHEATARISTMONTORSÇ
-
- TheAIMworkspaceallowssimultaneousstorageof4images:A,B,
- CandD.Eachimage(monochromeorcolor)occupies64kB.A
- monochromeimage(storedondiskwiththeextension.IM)consists
- of256*256pixels,having8bitsofgreyvalueinformation(i.e.
- 256greyvaluespossible).Colorimages(extension.COL)consist
- of128*128pixels,having24+8=32bitsofcolorandluminance
- information.ForthedisplayofcolorimagesAIMsupportsthe
- ST'slo-resmodeonly(320*200pixelswithapaletteof16
- colors).
-
- YoumayhavewonderedwhyAIMuses4Bytesofinformationfor
- pixelsof.COLimages.Wouldn'tacolorimagebeperfectly
- definedbyjustusing1Byteforeachcolorsub-image?Theanswer
- is:yes,itwould.Fortechnicalreasons,however,wehavechosen
- toaddenextrabyteforluminancedefinition.Thisformat
- allows,forexample,themonochromedisplayof.COLimages.
-
- WewilldiscussthedisplayofAIMimagesin4different
- situations:
-
- Monochrome(.IM)images-monochromedisplay(hi-res)
- Color(.COL)images-monochromedisplay(hi-res)
- Monochrome(.IM)images-colordisplay(lo-res)
- Color(.COL)images-colordisplay(lo-res)
-
- ê
- ÇMonochrome(.IM)images-monochromedisplay(hi-res).
- ü
- ÇAsanextensiontoourcheckerboardmodelwemightintroducea
- stackof8checkersplacedoneachfield,representingthe8grey
- valuebitsofthecorrespondingpixel.Awhitecheckerrepresents
- a'1',ablackonea'0'.Dependingonitspositioninthestack
- theweightofawhitechecker(i.e.thecontributiontothegrey
- value)is128,64,32,16,8,4,2or1.Thus,ifthelowerthree
- andtheuppertwocheckersarewhite,thecorrespondinggrey
- valueis(128+64+32+0+0+0+2+1=)227.
- ë
- ÇInourmodelwehave8horizontalplanesof256*256checkers,
- eachplanecontributingitsownweighttothetotalimage.Note
- thateachplaneitselfactuallycorrespondstoabinaryimage,
- hencethename:übitplanesÇ.Theupperplane(b1)istheleast
- significantbitplane,thelowerplane(b8)isthemost
- significantone.InAIMthe8bitplanesofagreyvalueimagecan
- beprocessedas8separatebinaryimages.Bitplanesofoneimage
- canbecopied(command:BCOPY)tooneormorearbitrarilychosen
- bitplane(s)ofanother.Usingthisfacility,agreyvalueimage
- canbeusedasa(temporary)storagefor8independentbinary
- images.
- ë
- ÇAsdeterminedbytheSThardware,inthehi-resmodeonlybinary
- imagescanbedisplayed.AIMcircumventsthislimitationbyusing
- atrickcalledüsigma-deltatechniqueÇ:the256greyvalues
- availableintheimagearerepresentedaswellaspossiblebydot
- densitiesinthedisplay.Thisyieldsa256*256*1bitdisplay
- withareasonablesuggestionofgreyvaluestothehumaneye.
-
- Aspecialsituationoccursifwewanttoprocessmonochrome
- picturesfromthedrawingpackageDEGAS.MonochromeDEGAS
- pictures(extension.PI3),beingbinary640*400pixelimages,
- cannotbeprocesseddirectlybyAIM.Whenreadfromadiskthese
- imagesareconvertedtoa320*200pixelimagewith5levelsof
- greyinformation.The640*400pixelsaregroupedin320*200non-
- overlapping2*2fields.Eachpixelinthefinal320*200pixel
- imageisattributedtheaveragegreyvalueofthecorresponding
- 2*2field:
-
- 0pixelswhite->greyvalue:0
- 1pixelswhite->greyvalue:63
- 2pixelswhite->greyvalue:127
- 3pixelswhite->greyvalue:191
- 4pixelswhite->greyvalue:255
-
- Subsequently,theconvertedDEGASimagesgetthesamesigma-delta
- treatmentastheregular.IMimagesforthedisplayofgrey
- values.Notethatinthisprocessinformationislost;the
- resultingimagehaslessthan320*200*3=192,000bitsof
- information(originally:256,000bits).Consequently,eventhough
- AIMcanre-convert(loosinginformationagain!)theseimagesback
- toDEGASformat,theoriginalpicturescanneverberecovered
- completely.
-
-
- Color(.COL)images-monochromedisplay(hi-res).ê
- Ç
- ÇForthedisplayofa.COLimageonamonochromemonitor,onlythe
- 128*128pixelluminancesub-imageisused.Thesigma-delta
- techniqueagainconvertsthisluminanceinformationtodot
- densities.
-
-
- Monochrome(.IM)images-colordisplay(lo-res).ê
- Ç
- Monochrome(.IM)imageshave8bits(256levels)ofgreyvalue
- information.Whenan(.IM)imageisreadfromdiskinthelo-res
- mode,AIMwillloadthe16colorpalettewiththemaximumof8
- levelsofgreyandappliesthesigma-deltatechniqueto
- interpolatebetweenthese8levels.
-
-
- Color(.COL)images-colordisplay(lo-res).
-
- Forthedisplayof.COLimagesinthelo-resmodeAIMfirst
- determinesanoptimumpaletteof16colorsfromthepaletteof
- 256*256*256colorsavailableintheoriginalimage.The8bitsof
- luminanceinformationisnotused.
-
- Thepaletteforaparticularscreenisderivedfromtheimagein
- theactivewindowonly;thismaynotbetheoptimumpalettefor
- otherimagesdisplayedsimultaneously.
-
- InthismodecolorpicturesfromtheDEGASandNeochromedrawing
- packages(extensions.PI1and.NEO,resp.)canbereadbyAIM
- also.Again,sizereduction(to160*100pixels),greyvalue
- attributionandthesigma-deltatechniqueareappliedforthe
- processinganddisplayoftheseimages.
- ë
-
- IMAGEPROCESSINGCAPABILITIESOFAIM
- Ç
- TheimageprocessingsoftwarepackageAIMhasbeenwritteninthe
- Clanguage,usingtheMarkWilliamsC-compiler.Itmakes
- extensiveuseoftheGEMwindowstructurefortheuserinterface
- andthedisplayofimages.AIMallowsprocessinganddisplayof
- monochrome,binaryandgreyvalueimagesaswellasofcolor
- images.Ithasaninterface(viatheAtariST'sDMAbus)to
- monochromeandcolorframegrabbers,developedinthePattern
- RecognitionGroup.
-
-
- Theuserinterface.
-
- Imageprocessingoperationscanbechosenfromdrop-downmenues,
- usingdialogboxes,aswellasbytypingtheappropriatecommand
- inthecommandbox.Inanycasethecommandsaretransferredas
- stringsbytheWindowManagementSystemtotheCommand
- Interpreter.ManyoftheAIMcommandscannotbeinvokedfrom
- drop-downmenues.Theywillbedesignatedbyanasterisk(*).
-
- Thecommandinterpreterstartstheimageprocessingroutine.It
- isnotnecessarytotypethecompletecommandname;anynumberof
- charactersthatdoesn'tgiveambiguitieswilldo.
-
- ÇSequencesofcommandsmaybecombinedinacommandfileormacro.
- Commandfilescanbenestedto16levels.Theyareautomatically
- createdbyactivatingtheLoggingfeature;anyoperationyou
- performafter'Logging'ischecked,willbelogged.Macroscanbe
- savedtodiskforre-use.Theextensionforthefilenameis.AIM.
- Amacroisexecutedbytypingthename(withoutextension),
- precededbythecharacter'@'.Clickingthemenu-entryMacroand
- thenameinthedialogboxwilldothesame.Pausingthe
- executionispossiblebyhittingtheEsc-key.Proceedwiththe
- macrobyhittingReturnorstopbyclickingintheappropriate
- box.
-
- ThecommandsintheCommandWindowcanbeeditedsimply.Delete
- andbackspaceworklikeinmostwordprocessors.Control-Xdeletes
- awholeline.
-
- Allcharacterstypedafterastar(*)willbeignoredbythe
- commandinterpreterandthuscanbeusedforcomments.
-
- Typingaquestionmark(?)and<Return>willdisplayalistof
- availableoperations.Thesyntaxandashortexplanationforthe
- commandscanbefoundinHelp-files.ChooseHELP!!!inthe
- Utilitiesmenu.Note,however,thatthisversion(2.5)ofAIMhas
- beenextensivelyrevised.Manyoperationshavebeenaddedand
- someoftheexistingoperationsallowmoreparameterstobe
- specifiedthanthosegiveninthecurrentHelp-filesanddialog
- boxes.Fortunately,alloperationsareupwardcompatible.The
- AIMANUAL.DOCintheCOMPRESSfoldercontainsanupdated
- descriptionofalltheavailableoperations.
-
-
- ëEXAMPLESANDDEMOSÇ
-
- TheexamplesontheAIMdiskareself-explaining.Theonly
- prerequisiteisareasonableunderstandingoftheprevious
- chapters.Becausethediskspacewaslimited,wecouldonly
- includesomeofthemostrelevantexamples.Consequentlythey
- coverjustafewofthepossibleoperations;mostofthe
- operationswillhavetobeexploredbyyourself!
-
- ThecommentedcommandfilesEXAM1.AIM->EXAM5.AIMhavebeen
- includedsothatyoucancheckyourmanuallyenteredexercises.
-
- Besidesthepreparedexamplesthreeextrademos(macros)have
- beenincludedonthedisk:DEMOCER.AIM,DEMOHFE.AIMand
- DEMOSCH.AIM.Theycontainsomeoperationsandstrategiesthatmay
- beofinteresttoyouafterhavingcompletedtheexamples
- successfully.
-
- Finallytwoexercisesareaddedto(self-)testyourabilities.If
- thingsgototallywrong,don'tfeelembarrassedbypeepinginto
- themacrosPRAK1.AIMandPRAK2.AIM;theycontainpossible
- solutionsfortheseexercises.Theexercisesarecompressedfiles
- andcanbefoundinthefolderCOMPRESS.
-
- Incaseyoumissedapoint:inagreyvalueimage'black'
- correspondswithavalue0,'white'withavalue255.Inabinary
- image(orabitplaneofagreyvalueimage)thesevaluesare0
- and1,respectively.
-
- ÇAllexamplesandexerciseswillworkinbothmodes,lo-rescolor
- andhi-resmonochrome.Forbinaryoperationsamonochromemonitor
- isrecommended.Somedemosaremoreimpressiveincolor,though!
-
-
- üExampleEXAM1.AIMÇ
-
- Operationsused:Histogram,Equalize
-
- FirstwewillretrievetheimageMOON.IM.Clicktheentry'Read
- Image'underthe'File'menu.Thedefaultsintheselectorbox
- thatpopsup('Window:A'and'STANDARD')areacceptable,so
- click'OK'(orhittheReturnkey).Thoseofyouwhoprefera
- commandlineinterpretermightaswelltypein'readA'instead
- ofusingthemouse.
-
- NextaGEM'ITEMSELECTOR'appears.Choose'MOON.IM'andaftera
- fewsecondsapictureappearsinWindowA,thatshowsthefoot
- ofmoonlandersuroundedbymoondust.Youwillagreethat,
- normally,youwouldthrowsuchapictureinthetrashcanand
- probablydeclarethemissiontothemoonaflop.AIMcanhelpyou
- dealwithsuchfrustations!
-
- Justtogetafeelofthepoweraccumulatedinthattiny3.5",
- trytheoperation'Equalize'underthemenu'GreyOps'.ChooseA
- astheinputimageandBastheoutput.Looksbetter,doesn'tit?
- Remember,theinformationwasalreadyintheimage;evenwithout
- AIMthemissiontothemoonwasn'tinvain!Buttheapplication
- ofAIMcertainlyaddstothesucces.
-
- Tounderstandwhathashappenedtotheoriginalimage,trythe
- entry'Histogram'under'Utilities'.Thiswillshowagraphof
- thefrequencyofoccurrenceofaparticulargreyvalue(or
- rather:asmallrangeofgreyvalues)intheimage,plotted
- againstthegreyvalue.Frequenciesareplottedvertically,grey
- values(0->255)horizontally.Thehistogramindicatesthatthe
- greyvaluesintheoriginalimagewereconcentratedina
- relativelysmallrange(centeredaroundgreyvalue50).
-
- Fromthehistogramwecanconcludethatthegreyscalefrom0to
- 255hasnotbeenusedefficiently;nearlyallpixelshaveagrey
- valuebetween,say,25and75.Theresultisthat,inaway,we
- arelookingattheprintingonatoyballoon;onlyifweinflate
- theballoonsomeofthesmallerdetailswillshow.Ifsomehowwe
- couldstretchtheoriginalgreyvaluerange,sothat25would
- shiftto0and75to255,thesameeffectmightbeimposedonour
- moonimage.Throwingawaytheranges0->25and75->255doesn't
- domuchharm,becauselittleinformationwillbelost.
-
- Equalizationistheairpumpthatinflatesagreyvaluerange.
- Unlikeanairpump(andthesuggestionintheprevious
- paragraph!)itdoessointelligently.Thatis,thestretching
- effectonaparticularrangeofgreyvaluesdependsontheheight
- ofthehistogramforthatrange.Rangeswithhighvaluesinthe
- histogramwillbeexpandedatthecostofthecompressionofless
- prominentranges.Note,thattheremaybemultiplepeaksand
- valleysinthehistogram.Toseewhatwemean,determinethe
- histogramofimageBandcompareitwiththeoriginalone.The
- frequencies(verticallines)aredividedmoreevenlyoverthe
- availablerangeofgreyvalues.
- ÇRangeswithhighfrequenciesofoccurrenceintheoriginal
- histogramhavebeenstretchedandthosewithlowfrequencies
- compressed.Ifyouarenotcompletelysatisfied,performthesame
- operationsontheimageTRUI.IM,whichhasmultiplepeaksinthe
- histogram.
-
- Equalizationisaniceexampleofimageprocessing:important
- features(inthiscasegreyvalueranges)areemphasizedatthe
- costoflessimportantfeatures.Yet,inthisparticular
- operationnoinformationislost;a'de-emphasis'procedure(not
- availableinAIM)couldrestoretheoriginalimage.
-
- Hint:ifyouwanttogetridofthehistograminaparticular
- display,use'Gdisplay'intheUtilitiesmenu.
-
-
- üExampleEXAM2.AIMÇ
-
- Operations:Gradx,Grady,Enhance
-
- ReadtheimageTRUI.IMin(thedefault)WindowA.Thisimagehas
- becomeakindofreferenceformanygroupsinvolvedinimage
- processing.
-
- Performtheoperation'Gradx'intheGreyOpsmenu.Acceptallthe
- defaultsproposedbyAIM.WorryabouttheMultiplyandAddvalues
- later,orbetterstill,experimentwiththem.
-
- TheGradx('gradientinx-direction')operationdeterminesthe
- rateatwhichgreyvalueschangeintheoriginalimageand
- attributescorrespondinggreyvaluestothepixelsoftheoutput
- image.Anoutputpixelgetsagreyvalueaccordingtothe
- formula:
-
- grey-out=(gradient-in)*Multiply/1024+Add.
-
- Thisoperationshowsverticaledgesintheimage.Anedge
- correspondstoastepingreyvalue.Notetheeffectonedgesin
- thegirl'shat.
-
- NowperformGrady.ThistimesendtheoutputtoWindowC.Note
- theresultforhorizontaledges(mouth,eyebrows,etc.).
-
- Arelatedoperation,whichisgenerallyusedtosharpen-up
- picturesistheEnhance-operation(inmenuGreyOps).It
- determinesthesecondderivative(inbothdirections)ofthe
- grey-valuesintheinputimage.LikeGradx/yitemphasizeshigh
- frequenciesintheimage.Highfrequenciesoccuratsharpedges.
- TrytheEnhancefilterontheoriginalTRUI.IM.andenjoythe
- improvement.Butwhatdidwedotohereyes?Seemswecreatedher
- contactlenses...
-
-
- üExampleEXAM3.AIMÇ
-
- Operation:Medianfilter
-
- ReadimageBNOISE.IM.Thisimagehasintentionallybeendegraded
- by'shotnoise'.Thistypeofnoiseoccursofteninthe
- transmissionofsignals.Someofthepixelsdifferverymuchin
- greyvaluefromthesurroundingpixels.Inthiscasetheyare
- white.Wewanttousefilteringtoremovethenoise.
-
- Usuallyitisdifficulttopredicttheeffectsoffiltering.
- Variousparametersmustbespecified,requiringmuchintuition.
- Try,forexampletheentry'Filter'intheGreyOpsmenu!
-
- Agoodfilterfortheproblemofshotnoiseistheso-called
- medianfilter.InthisoperationAIMdeterminesthegreyvalues
- in3*3neighborhoodsforeachpixelintheinputimage.These
- valuesaresortedintableswith9entries.The5thentryineach
- table(the'median')becomesthegreyvalueofthecorresponding
- outputpixel.Thegreyvalueofashotnoisespeckislikelyto
- beintheextremesofthetablesinwhichitappears,andthusit
- willberemoved.
-
- Performtheoperation'Median'intheGreyOpsmenu.Onlyafew
- stubbornnoisespeckswillsurvive.Theymayberemovedbya
- repeatedapplicationofthisfilter.
-
-
- üExampleEXAM4.AIMÇ
-
- Operations:Copy,Lmin,Lmax,(*)mindev,Gdisplay
-
- OncemorewecallonTRUI.IM;readitfromdisk.Wewillneeda
- secondcopyofthisimageinWindowB.Therearetwooptions:
- a.ReadtheimageagainfromdiskandhaveAIMputitinWindowB
- b.Use'Copy'inmenuGreyOpstocopyWindowAinWindowB.
-
- Notethatthereisa'Copy'entryintheBinOpsmenutoo.This
- binaryoperationcopiesonlybitplanes,asopposedtoagrey
- valuecopy,whichcopiesall8bitplanesofanimageatonce.
-
- Ifallwentwell,younowhavethefabulousTruitwinsonscreen.
- Thefirstoperationtobeperformedis'Lmin'intheGreyOps
- menu.Thisoperationlooksforthelowestgreyvalueinann*n
- neighborhood(ntobespecifiedbytheuser)oftheinputpixel
- andattributesittothecorrespondingoutputpixel.Thisfilter
- hasatendencyofexpandingdarkerareasintheimage.Tryit
- withn=9andputtheresultinWindowC.Experimentalittlewith
- differentvaluesforn.Observetheeffectsonnostrilsandeyes!
- Inanycaseendwitha9*9Lmin-nedTRUI.IMinWindowC.
-
- Nextapplythe'Lmax'filteronWindowA.Choosen=9andputthe
- resultinWindowD.Thisfilterexpandslighterarea'sinthe
- image.Wehopethatuntilnowyouacquiredenoughintuitiontobe
- abletopredicttheeffect:gonearethosenostrilsandgoneis
- thatmouthinthe'lightershadeofpale'thatsurroundedthem.
-
- ÇButnowtherealimageprocessorarises.Wearegoingtousean
- operationthatusesthreeinputimages:(*)mindevC,D,A.This
- operationcomparescorrespondingpixels(i.e.pixelswiththe
- samecoordinates)intheoriginalimage(A)andthetwoother
- images(CandD).Theoutputpixelgetsthegreyvalueofthe
- correspondingpixelinCüorÇD,dependingonwhichoneofthetwo
- isclosesttothegreyvalueinA.Bigdeal,butwhatisthe
- effect?
-
- Let'stryitfirst.The(*)mindev('minimaldeviation')
- operationcannotbeinvokedfromthemenu,sowehavetotypeit
- indeCommandWindow:typemindevC,D,A<Return>.Theresultwill
- beshowninWindowA.Compareitwiththeoriginalimage,which
- isstillluringinWindowB.Apparentlytheedgesintheimage
- (cheeks,hair)havebeensharpened.TheneteffectofLmin,Lmax
- andmindevis,thatnearedgesthereisabacklashingreyvalue.
- Inotherwords,greyvaluesarereluctantagainstchanges;
- changesoccursuddenlyasafunctionofposition.
-
-
- üExampleEXAM5.AIMÇ
-
- Operations:(*)Clear,Threshold,Invert,Propagation,Bdisplay,
- Reset,Exorand(*)Measure.
-
- ReadtheimageCERMET.IMfromdisk.
-
- Ourpurposewiththisexampleistodosomemeasurementsonthe
- objectsinthisimage.The'(*)Measure'operationrequiresthe
- objectsofinteresttobewhiteinablackbackground.Inthe
- menu'BinOps'wehavesomeusefuloperationsatourdisposalto
- achievethatgoal.
-
- Inordertobeabletoapplybinaryoperations('BinOps'),we
- firstwillmakethegreyvalueimageinWindowAbinary.The
- operation'Threshold'intheGreyOpsmenumakespixelswitha
- greyvaluebelowthethresholdblackandpixelswithagreyvalue
- aboveitwhite.Whentheoperationisinvoked,itproposesa
- thresholdwhichistheaveragegreyvalueintheimage;itisnot
- necessarilythebestguess,butusuallyityieldssatisfactory
- results.
-
- Stop!TheThresholdoperationwillaskforthebitplanewherethe
- binaryimageistobestored(itdefaultstob1inWindowB).
- However,asourpreviousexerciseswillhaveleftsomegarbagein
- theotherbitplanesofWindowB,wefirsthavetoclearthose.
- Theoperation'(*)Clear'isprovidedtoclearallbitplanesofa
- windowatonce(clear=greyvalue0=black!).Type:clearB
- <Return>.
-
- NowwearereadyfortheThresholdoperation;clickonitinthe
- GreyOpsmenuandacceptthedefaults.
-
- Asweneedwhiteobjectsinablackbackground,thepicturein
- WindowBmustbeinverted.Clickon'Invert'intheBinOpsmenu
- (acceptthedefaults).
-
- ÇNotethatsomeoftheobjectsneartheframeofthewindoware
- onlypartiallydisplayed.Wedon'twantthe'(*)Measure'
- operationtotaketheseincompleteobjectsintoaccount,buthow
- canwegetridofthem?Howcanwedistinghuishthemfrom
- completeobjects?Theansweris:usethe'Propagation'operation
- (inCelOps).
-
- The'Propagation'operationallowsustoisolateobjects.White
- pixels(called'seeds)will'grow'(expand)underthecondition
- thatinagivenreferencebitplane(the'mask')thecorresponding
- pixelsarewhitetoo.Wecanvisualizethisoperationastaking
- placeinafieldwithseeds(=whitepixelsthatwewanttogrow
- toshapespresentinthemask).Thereferencebitplane(the
- 'mask')istheculturemedium;ithasfertileandinfertile
- regions.Ifaregionisfertile(i.e.ithaswhitepixelsthat
- coincidewiththeseedpixels),theseedcangrow.Inone
- 'iteration'(propagationstep)apixelgrowsinaccordancewith
- itsconnectivity:onewhitepixelisaddedinallconnecting
- directions.InAIMtheseedbitplaneiscalledCLP(Cellular
- LogicPlane).
-
- Inthenextiterationtheseedbitplane(CLP)thatresultedfrom
- thefirstiterationiscomparedoncemorewiththemaskbitplane.
- CoincidingwhitepixelsinCLPandmaskwill,oncemore,grow.
- Thiswillcontinueuntilallseedshavegrowntotheedgesofthe
- fieldsinthemask;wehavecreatedanexactcopyofallthe
- fieldsthatinthefirstiterationcoincidedwithatleastone
- seed.Thetrickofisolatingparticularfieldsinthemaskisto
- createaCLPwithseedsthatcoincidewiththosefields.
-
- Let'sreturntoourproblemofisolatingtheincompletewhite
- objectsatthebordersofbitplaneb1inWindowB.Itwouldbe
- niceifwehadabitplaneavailable(tobeusedastheCLP)with
- whitepixelsalongtheframeüonlyÇ.ThePropagationoperation
- wouldmakethoseborder-pixelsgrowtotheexactshapesofthe
- intersectedobjectsinthemask(inourcase:b1).Theresult
- wouldbe:twoimageshavingtheunwantedobjectsincommon.
- Subsequentapplicationofthelogicaloperation'Exor'(inthe
- BinOpsmenu)onthesetwoimageswillfinallyremovetheunwanted
- objects.Exoristheinequalityoperator:itcompares
- correspondingpixelsinboth(binary!)imagesandoutputsawhite
- pixelif(andonlyif)theyaredifferent.
-
- Nowthatwehopefullyunderstanditwecannotwaittoputour
- knowledgetothetest.Theonlyimageweneedisbitplaneb1in
- WindowB.ClickonPropagation.Wewillhavetochangealmostall
- ofthedefaults!Ourmaskbitplaneisb1insteadoftheproposed
- b2.Furthermore,wewilluseb2asourCLPinsteadofb1.The
- connectivityisnotimportant,butchangeitto8.Thenecessary
- whiteedgeforourCLPcanbechosenwiththeentry'Edgevalue'.
- Choose1(forwhite).Makethenumberofiterations100;thatis
- toomany,butAIMwillstopautomaticallywhenallgrowthhas
- stopped.
-
- CheckallentriesintheDialogBox:ifsomethingiswrongthere
- isariskthatyouhavetostartalloveragain!YourSTwon't
- complain,butwedon'twanttofrustrateprospectiveimage
- processorsinsuchanearlystage.
-
- ÇHitReturn.Ifalliswell,youwillseeanimageinbitplaneb2
- ofWindowBthathastheintersectedobjectsonly.Wrong?Don't
- worry,justkeeptrying.Don'tforgettoclearbitplaneb2prior
- toeveryPropagationoperation.
-
- NextinvokeoperationExor(inBinOps).Useb1andb2inWindowB
- asinputsandb3asoutput.
-
- Atlastourimageisreadyforthe(*)Measureoperation.This
- operationassumesthattheimageisinb1ofWindowB,sowemust
- copyb3tob1first.Click'Copy'inBinOpsandchoosethe
- appropriatebitplanes.
-
- (*)Measureperformsanumberofmeasurementsontheobjectsand
- displaystheresultsintheCommandWindow.Itassignsnumbersto
- theobjects(left->right,up->down)andlabelseachobject
- withagreyvalueaccordingtothisnumber.Thiscanbeobserved
- inWindowD.
-
- Typemeasure(meawilldo!)<Return>.NotethattheCommand
- Windowcanbesizedtobringallmeasureddataonscreen.
-
-
-
- That'sitforthemoment!
- Wewishyoumanyhappyhoursinexploringthispackage.
-
-